<template>
  <panel title="商品添加">
    <GoodsForm @success="success"/>
  </panel>
</template>

<script>
import { goodsaddReq } from "@/api/goods.api";
import GoodsForm from "./components/goodsForm.vue";
export default {
  components: { GoodsForm },
  methods: {
    // 商品组件，校验通过
    async success(form) {
      console.log(form);
      // 添加商品
      const res = await goodsaddReq(form);
      if (res.data.code === 0) {
        this.$router.push("/goods/GoodsList");
      }
    }
  }
};
</script>

<style lang="less" scoped>
</style>